package com.bac.rentmap.ad.flat.proccess;

import com.bac.rentmap.ad.flat.image.FlatImage;
import com.google.appengine.api.blobstore.BlobstoreService;
import org.springframework.beans.factory.annotation.Required;

public class OldFlatImageProcessor extends AbstractOldItemProcessor<FlatImage> {
    private BlobstoreService blobstoreService;

    protected void beforeDelete(FlatImage flatImage){
        super.beforeDelete(flatImage);
        if(flatImage.getBlobKey() != null) {
            blobstoreService.delete(flatImage.getBlobKey());
        }
    }
    @Override
    protected Class<FlatImage> getPersistentClass() {
        return FlatImage.class;
    }

    @Override
    protected String getDatePropertyName() {
        return "publishingDate";
    }

    @Required
    public void setBlobstoreService(BlobstoreService blobstoreService) {
        this.blobstoreService = blobstoreService;
    }
}
